Refactors the API