added time check to main