rearranging and cleaning up