Refactoring. WIP...