Changed way to filter images by extension