Major refactor, readme forthcoming.