improve code and document