changed isVisible function