Cleaned up code
Replaced C-style code with C++ style
Added support for POST content to be passed through