Fix some bugs.
Reformat code.
Clear warnings