Moved more code from dao.js to dao2.js.