Refactoring... wip