Refactor and hopefully fix http error catching - untested
Merge pull request #1 from DonnchaC/master

Refactor and hopefully fix http error catching - untested