Adding a check for visible.