add some comment, and minor cleaing-up