What do you think of using the ternary operator here to reduce the lines of code that are doing this?