Moved repeating code to save_prev()