Library rewrite