writeCode function

Write the code necessary to run a master process