Added first version of processMaster funciton. Changed main and rest of file to cope with new definition.