update code to make it hundreds of times faster for MWNTGenerator