deduplicate code, and fix the "repair" action