revised code to filter items on min spt