Put duplicate code in new method.

The method prepareAttach() now handles the preparation and attaching of
stream/circuit ID pairs.