Updated DB connection code