How to revert to an earlier state?