adding database clean up functionality