Rewrite

See commit log.