Add Uml and refactor some part of code