Add API for rewriting history