Added InvalidContentException and improved exceptions code