Lots of API cleanup and changes