Tidy up and changed random number generator to g_MTRand