api refactoring