Make compatible with web workers