Added comments and useful messages. Also added back the code from the original curl.c