This nested ternary and the one below it seem hard to follow (although maybe I haven't woken up yet!). Could this be redone into an `if else` ?