Don't try to parse content on responses that don't contain any data (fixes #513)
Replace overly long, double ternary expressions with if/else clauses