Making the connection object more flexible
Minor tweaks to clean up