use nonEmpty and isDefined