Refactoring

WIP