remove unnecessary global var
use strings.NewReader instead of buffer