updated timing function