cleaner implemention of filterAcc