got it working under fairly extensive testing. TODO: fill out README, and do some more testing