some refactoring, change the flow so only one loop set