Fix can't modify frozen Hash error
Refactor updating of permissions
Merge branch 'master' into dev