add doc for function and some code editing typos