Was there any reason for the change in position of the if statements in the sql file. Makes the output more readable?
Yes
Looks like we need some test to ensure that the Sequence issue does not happen again. Maybe a Unit Test is good enough, to ensure that we are creating a good SQL