improve scala style