Neatened up database class.