Move the bulk of the common routines into a seeprate file.
Added code to use theirIdentityPublic before PANDA has completed.