Separated run function into setVisible and setHidden.