Clean up code in Connection class