Update refactoring
Add pseudocode