API refactor