Changed to use the Scala API's command combinators more effectively.