Code examination

1) Check the codes.
2) Add some comments