Implemented new permission system

re #188