Changed filtering method. Getting an array of required ids and then grepping on that list