consolidate conditional expression refactoring