simplified the timing code