Subject to the provisions of this article, a nonconforming structure or use may be continued and maintained in reasonable repair but may not be altered or extended, except that the extension of a nonconforming use at the time this chapter is adopted shall be permissible, and except that a structure conforming with respect to use but nonconforming with respect to height, setback or coverage may be altered or extended if the alteration or extension does not deviate further from the standards of this chapter. If a preexisting use or structure is legal and nonconforming or was conforming under the previous ordinance but becomes nonconforming through the adoption of this chapter, then it shall become a legal nonconforming use or structure and subject to the provisions of this chapter. If a use or structure was illegal under the provisions of the previous ordinance, then it shall remain illegal or nonconforming only as it pertains to the provisions of this chapter.