added some psuedocode