Made changes to the peak variables, added extra variables to help determine the phase values.