total refactoring: wip