updated script with filter object conversion function