Moved controller code to its own CharacterController class