Updated async-next code - added test function