fix algorithm to use Worker.this is preparation.
add worker method, adding promise
add promise
little fix. indents and comments.