Added new test for loops, and fixed bug #1

Also added some debugging capabilities. Going to add even more in the next commit.