refactor to turn if/else statements into ternary statements