Reduced nested conditional to compound expression

Fixes #3527