Updated curl function