Rewrote a whole lot of stuff and updated the README.