Code deduplication in module Visibility.
More cleanup in Visibility.
Some cleanup.