rewrite code, so it easier to use