improve doc, refactor