refactor uniqueFilter; improve stream flow readability