Fixed some bugs
Some formatting changes