General rewrite + in-code documentation