added initial pseudocode