Uniform api

* This contains all the api changes from #259 but without any of the JS. 
* Since it only changes the backend, the js should be unaffected.