Small tweaks to loop