Added shuffle rule logic