more scala like code