Moved Update and Delete sql generation into separate funcs