Refactor API methods