Add repair ability, fix bugs