Abstracted out part of the code in GenerateStep to make debugging easier and to make the code nicer. The previous error persists, and once again this will not be the last commit to this branch before it is merged to master.