change RGFilter to the author's implemention