Made some sql changes