Added two lines to store whether the connection is local in a variable for easy access