added some extra doc strings & comments to the code