Updated async function to accept callback