added back the while loop when making the post requests