added rewrite method