refactor to avoid need for manipulating double stats and casting #3850