fixed mistakes, implemented cURL function