Documented and cleaned up most of the connection code.
Documented and cleaned up the rest of the code.