Refactoring the cli script to include filters