Refactoring to match the API