Refactored code into more cohesive objects.