scala fun code for play