added modified Algorithm 1 pseudo code