Splitting toggleVisibility into two functions: toggleVisibility and toggleDisplay.