added comments to psuedocode