Update documents, some code improvements