Lots of tweaks to api