Use tuple instead of set and removed unused variable.