add logic to check visibility