Working towards a phase correction system

C code Broken in this comit!!!