Refactored code to depend on connection handler's #with_connection instead of #connection.

Any place that called #connection that did not store it in some field was changed to use #with_connection because #with_connection will create a connection, run the block that needs that connection, and then let go of the connection so that connections are held onto.