more refactor API WIP