Coursera Scala course assignment #6