Move file detection into its own class.