quite a bit of refactoring; the README is now horribly out of date