Merge rewrite into master 

It *looks* stable enough.