Ternary operator result was inverted (I must have been tired).
Critical code was added after the return statement, oops.