Major cleanup of COMP 3980