refactored total filter