updated logic for three of a kind