Added some comments and fixed coding style will hunting for a bug