make APi asyncronous and implement functionality