some cleanup for filetype identification code