Added cgem and corrected faulty findtc routine