Trying to understand code

Added some comments