Added back in the sql queries