Complex sentence: He retired on October 1998 but was on contract from 1999 to 2002, and thereafter until he died he taught and supervised graduate students in the department, gratis.
Split into simpler sentences: He retired on October 1998 but was on contract from 1999 to 2002. However from 2002 until he died, he taught and supervised graduate students in the department, gratis.