creating an average filter