add class diagram, refactor main class