File cleanup and basic undo button functioning.