wip: initial refactor