Use 4 spaces for indenting JavaScript code
Fix several typos and potential bugs in algorithm.js