edited doc and good code reformat