ported over webworker code from GPU branch, just for testing.