Changed quality equation and also changed sort method back to first lambda method