Codebase

Refactored some code.