more cleanup, api is now completely json based, but still very unstable