Cleaned up filter code.