Tonight's coding: first thing I wanted to try wasn't going to work without resorting to dirty tricks so I backed out of that to see if I could come up with a better idea. Next approach was both cleaner and more powerful. Then I reorganized it a bit to shrink it down and make it less likely that I accidentally break it in the future.