modified to ignore diagrams