added initial connection state tracking