Switch from thread to async method