Total library rewrite