Further refactoring into multiple files

Use search rather than filter for more flexible matching

Add cli searching for easier testing