Initial working loop
Fixup lines and names