bring in the code that was discussed on Mantis #6068,