Fix for content-type bug plus a little refactoring and documentation improvements