reindent code

Signed-off-by: Hank Wang <drapho@gmail.com>
reindent code and more comments

Signed-off-by: Hank Wang <drapho@gmail.com>