Removed an extra loop iteration by checking for isVisible along with the rest of conditions