loop for synthesis