some more rewriting