new logic for sensing file type