improve doc | refactor cocde + tests