Refactor worker code to be totally unobtrusive