Added ability to average both columns and rows