refactoring apis