Fixing/implementing debug in the CURL version

sorry if I've gone about this the wrong way - I'm new to GitHub but used codebynumbers' CURL version of this project and wanted to share my fixes to get the debug working.