Fix a loop, remove some console logs