refix #79 changed all the for loops for real ones