refactroed the program index filter