Try rewriting this logic using simple `if`'s, without creating objects.