Added some comments to the onDocumentReady function