Added checks for file extension.