contents rewrite and tests