massive API refactor