Refactor permissions