changed filter function again, and added sumation functions