Refactoring CharacterController into a library