Moved visibility test to a more suitable file