added check for file extensions