API function refactoring