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