Reduce conditional nesting