fixed some bugs and added class diagram