changed the calculation of violation score

Changed the way violation score is calculated.