Add some comments and do some cleaning