Refactor DB connection data storage ot make it neater