no need to check the time inside loops three times