debugging code - check if it works first
Debugging- implementing more xcheck plots for all stages in the calculation