fix the merge conflicts and did some formatting of the code