Refactoring of DBConnection class