Modified class to follow the diagram

Added some comments