Refactored some code to have a more coherent structure.