rewrite library