Add early sql script, improve API calls, take out debug