added logic for swapping to alternative filetypes