A nonconforming use or structure shall not be rebuilt, altered, or repaired except as provided herein. However, if any rebuilding, alteration, repair, restoration or replacement is permitted by this Code, the following shall apply: A. If the structure is altered or repaired, said alterations or repairs shall be in conformity with the ICC Residential codes in force at the time of said alteration or repair; provided, however, that said alteration or repair shall not extend or enlarge the structure being altered or repaired except to bring the structure into conformity with the ordinance. B. If the structure is totally rebuilt or replaced, the replacement structure shall conform to all the requirements of this appendix.