[refactor] Refactored ApiLogic to be simpler (8m)