improved the connection flow somewhat