Update to work with averaging