Extracted createSpawn function in test harness
Tidied test harness