initial implementation of repair