Fixed some for loop stuff
Got some rudimentary tests going
Added some tests and fixed a few bugs I found during testing