changed filter to support objects and functions