heavy api refactor