added my pseudocode