Rewrite pseudocode