Clean up code a bit by creating methods on Connection struct