Refactor API so that is more readable