Updated Scala M implementation