Cleaner way of toggling visibility of overlay