refactor and class diagram