1st time pits are open, ONLY lead lap cars can pit. After coming out of the pits the lead lap cars would line up behind all lap down cars who will be pitting next time by.
The next time by the pits is when all lap down cars would then make a pit-stop (this would also be when the lucky dog gets his wave around after pitting) Also if a lap down car chooses not to pit they too would get the wave around with the lucky dog as long as they do not make a pit-stop and are ahead of the leaders.
if 1 leader happens to stay out and not pit, then no lap down cars other than the lucky dog could get the wave around.
Once everyone is caught back up and in line, green is called at the start finish line.
I feel this would avoid alot of confusion. Instead of having everyone pit together and then trying to sort it out. This is how nascar does it and they seem to not have any problems.