Cleaned up JEFRi filter.

Broke the filter into an algorithm and a config section. Cleaned up a lot of the logic. Fixed some logic bugs.