added filetype detection