Refactoring of add visit API.