Additional changes to loop.js