Revised loop. Still doesn't work.