refactoring cell menu hiding logic