Implemented remaining functions in AccountPermissions. Also fixed a few bugs and refactorizations.