Revised to use new curl function