improved loop

replaced dumb and backwards code with some normal code.