Some optimizations were made. Refactoring + optimizing memory usage for phase synchronization method.