restserver now frees memory better
now uses bytes.NewBuffer instead of appending, saving memory usage