Added filetype detection.