Fixed some bugs and style