Added psuedocode