Changed 'p's to 'k's to conform to ocnvention.
Aesthetic correction to energies func.
Slight changes to scripts.