I'm sure everyone implements their own solution. This isn't rocket surgery. Show us your code that works great but doesn't, and perhaps we can suggest an improvement to it so that it works all of the time.