added scala code