Rewrite prepare lib