Update extension detection code