consolidation of functions and passing extra parameters with libcurl