refactored API class