rewrite/cleanup