changed from if else to ternary