cleaned up chat parsing. added keepalive check.