Added comments explaining relevant classes and functions