Basically finished the api part