Correctly handle async calls; fix formatting