Tweaked for loop