changed get avg slice to use numeric throughout to avoid integer overflow