reformat code
Add debug log