Some codechanges and additions on class.database.