even more fixes, and implemented the for loop