Modified function definition for Scala 2.9 (?)