added commenting and UML diagram