migrate to scala