updated curl function