Some type extraction code