updated code to average over the symmetries