Added trim_filter to remove leading and trailing whitespace