moved update visiblity code as seprate method