merged code with Jeff's rng code. everything compiles