Add some comments and remove debug code