fixed logic error in filter, and tuned parameters