Modified db.js to encapsulate operations inside of a Connection class.