trying to fix looping