Tried a different loop and some other things. Thomas's code was closest I think.