Refactor Contact UI logic.