CheckLatency/MaxLatency (taken from #141)

Merged from @ruaanviljoen's original #141 submission.