json_decode handling when content type isn't specified. Also some CS fixes.