add doc, refine code style