Api refactoring