RNG code cleanup