Code refactored for Randomizer