Use local functions instead of requests to query api