Added database and other minor fixes.