Refactored valid_file_type and prompt_path so that the call to file_type now happens within valid_file_type.