code from scala akka and functional programming scala