maximum penalty value for the QI calculated
meaningfull comments added. unecessary code removed.