SetHiddenMode function Refectoring.