Slight cleanup of key manager HTML and dialog handling