added time checking