refactoring visibility determination into factory