improved some handling of permissions - stronger typing for them