Rarity selector and huge code refactoring.