refactored to asynchron job processing, added tests