Added local or remote detection to determine where to route user