Imrpove Scala generator