tweaking latency algorithm