Added check for file extension