Replace original code with npms completion.js.
Minor coding style changes.