Refactored permission system #91.