$result variable is reliably set now + PSR-friendly formatting
User-friendly handling of wrong result content-type