Added id comparison logic.