Moved filetype reading