Better filetype detection