rewrite duplicated operator code