added Yoon's edit
attempted to add pseudocode style