adding new api for asynchronous and synchronous.