rewrite part of code