Improve date detection, automatically set file type