Refactor API classes