saving before cleaning code