* Reimplement --rebuild option in the new engine (#2153) * Refactor --rebuild option * Fix comment formatting