Refactoring and API redesign