Modified to scala 2.9.2