added usage of conns.FLAG for exiting