Added documentation for loop() code