added a database maintenance function