Common ext detection code