Removed window reference in library to enable usage with web workers