small changs to spec_fitting routines to calculate the total energy