created a loop to run overnight