almost done writing the api wrapper