Filtering Update

Filtering now works the way it should, and I've cleaned up some code.