making it testable by taking a connection as a parameter