added isAllowed function