fix pseudocode and code