added a clean() function which makes sure that the database isn't somehow screwed up