assignment 3 - implementation of filterAcc and filter