wip on refactoring.