changed for loop running time to 6 from 10