Fix build with Go 1.
Output data as csv to be used by R.
Fixed bunch of vet warnings.