Clean up code in client side filter