Switch on var rather than comparing explicity each pass.