Change return API so it can be a mixin rather than a function