Added detection of PE type