Internal API refactoring