Can you make this an if/else? This is rather complicated for a ternary (I shouldn't have used one to begin with).