Addresses Issue #1

switched from = to<-
improved legibility of the for loops
and a few other small changes