Seperated out into master and worker