Corrected the times loop a bit