Added loop around call to curl