ported to scala and updated README