Add some comments and fix a great bug