DWITE 2010-03 P5: Simplified and sped up code.