moved filetype finding things to a helper
fixed merge