rePermissions and refactoring