add documentation and some fix