wip: huuuuge refactoring