refactor of libcurl