Removes repeated code
Adds code comments