Renamed O(N^3) visibility file and applied some refactoring