functioned visit table computation