simplified pseudocode