More complete api.go, needs struct methods