Fixing loop, and now it works