updated to work with better filtering.