Added output filtering in client and protocl. Fixes #41