Reformat code add debug log