major changes to the PermissionStack class. introduced single query system