refactored out rest.go so http.go stays more generic