create an encapsulating connection class
keep impure logic in main