lot of refactors (wip)