Refactor and cleanup. Now accepts arrays of CIFilters too.