refactor the setupTunnel prototype method