Removed debug code
Filtering condition more readable
Fixed wrong reference to local 'client'