Overhauled async function