added UML diagram from Ye.