Reformat code and some style change