Rewrote merlin asynchronous code