refactored entire API model