Added correction to Pseudocode and comments in the JS code