replacing detecttime with firsttime