added psuedocode