supporting sync and async