map and flat map in scala
http://www.brunton-spall.co.uk/post/2011/12/02/map-map-and-flatmap-in-scala/