Updated optional permissions scripts
Working implementation of permissions