Move DB connection to main method