Added extension detection.