Code cleanup
Added latency metrics