Another implement for the example with scala