Updated some sql for cleaning