Don't know what happend to the code i posted earlier in the thread, it seems to have been reformatted missing bits so would never work.

Here it is as an attachment

HPWM.txt