Moved transaction statistics calculations into a member function and placed all target type specific processing into their respective functions. Also inverted the connection keepalive check to also cover hinted queries.