deep refactoring (wip)