Made api asynchronous.