Rewrite indentation - make it simpler to understand and modify, and more robust. Fix README typo.