Refactored filter.pl for testing
Added more tests
Added tests for filter.pl