added batch option for average_xy.sh