added array implementation to trim filter