major refactor wip