added web worker support; fixed a bug with range function