Refactor API slightly to make it more consistent