minor refactor to ternary op