rearranging code