added a public function to check file type and made all other methods private