Clean up some connection code.