tests and filtering

I tend to prefer early returns at the top and less nested code.