refactor filter.py and add distance.py
refactor filter.py and add distance.py