Fix for non-HTML requests
Merge pull request #9 from possum888/patch-1

Fix for non-HTML requests - also simplifies the code along the way.