Removing more debug lines

Changing order of execution
Also removed some debugging lines which I had missed in the previous pull request (and wasn't able to add them before the pull request was closed)