Added undo previous action function