Some API refactoring