could be refactored as a ternary