Added spawn and wait function.
Merge branch 'master'.