Write pseudocode and comments for PE5