Bug fixes and simplificiation

* Code is much more simple now, and should handle a much greater variety of
  POST body content