promote declaring the worker environment to a function
refactor loading scripts into worker thread during tests and improve logging in the portal
indentation