Cleaning up some stuff. Adding a bunch more Kinvey logic.