Added in requiredFlag attribute logic