moving time out of the loop