Enhancements and bug fix.
Reformat the code.