Updating permission models

Beautifying code and adding functionality.
Revert "Updating permission models"

This reverts commit e9d10abf31c6bf5b16cea4033a019ac6dee1f9ac.