Staging latest

Hey Mike, here you can find the latest staging changes. We have cleaned up as much as possible, and we have moved around the classes, so it makes more sense now. There are still some constants, methods that have to be moved and sanitized, for example we have copied over the original permission export logic but we would like to meld the different permission related methods together. As I said to you today we'll start identify the code parts we can already commit, and we'll send separate pulls to you about it. And as we continusly clean the code, I'll push up the latest changes from time to time. Thanks, Mate