Refactoring the API