Extracting common expressions