Rename spawnWorker to createWorker and added createWorkerScript
Add enum value checking.