added checks for visibility