Added ability to change number of averaging points