First attempt at query engine
Fixed bugs with API calls