added some more comments to aid documentation