New c#.Net code added in place of the pseudo code, not verbatum with proces due to optomiseation techniques employed