rearranging and cleaning