rewrite for maps