Multi-clause filtering

Changes to implement multi-clause filtering. Doesn't support multiple users.