Started rearranging code to a nice neat layout.