cleanup and rebuild