Async and mutithread processing. Clean up code.