Cleaned the filter code