Added function to check extension of file