Update api to use local functions instead of url requests