Refactor code with reformatting

Reformat the code.

Re-base the master branch and adding the changes of  #56,#83