Adds permissions and public/private, with lots of attendent cleanup and bugfixes