Fixed bugs involving loop-command changes to index variable. Added more tests.  Submitted!