added validation and totalscore calculation