Added some performance tweaks to opening the database.