Added filetype detection