Adding debug functions to the code. Make region files at different parts of the alogorithm to check correctness