code refinement, updated docs