Do some cleanup and rearranging