Surely there is a way to write condition in a better way, or Scala is really weird. /cc @gklopper