cleaning up refactored api handling