Last night I was able to sort out a chunk of code that was giving me some trouble. I'm still getting some debug text to the console in certain rare conditions that I'd like to eliminate, but even in those cases the behavior is correct so I'm not going to worry about that too much.