created a loop and added time-stamping