transform to more "real" scala code. Only one strangly failing test