refactored Permissions.pm