adding minimum and maximum filter