Purrrrrrrrfect. Why do these 'simple logic' questions evade me all the time?! What you show is _exactly_ what i was looking for —a mathematical solution rather than a hard coded if/then sequence (really that's what i was doing) covering all the bases. Imagine doing that for something with hundreds or thousands of possible states! Sheesh! I feel so stupid.