Cleaning code after self-review, fixing a bug in poorly-conceived demo code; now uses real logic! :P