Update with pseudocode, initial, and refactored