refactored API