Refactoring api