* Refactor some parts of the codebase