Major update.
Implemented the filtering. But not yet tested.