All functions should correctly check for filetype