New version supporting sync and async