Refactoring to simplify API