Move the ssh code out into its own module and communicate with it via a queue.