Implement searching and filtering more cleanly.