Refactor API to be more consistent