Updated average to 2D average in a better way.