More robust visibility checking.