updated sql cleanup