added more support for permissions and groups