implement rebuilding a database.