api refactoring (wip)