1. Fixed both rule 2 and rule 4 for handling the IN case