working on a scala version