index.js: emit an actual error on ERROR message
index.js: oops, there's no prefix for ERROR
index.js: fix typo
Cleanup

It could still use some more cleanup, but at least now it passes JSLint
apart from some nonsensical "unused variable" errors.
index.js: move soontm.toLowerCase near the rest and document it
test.js: fix typo (s/corrent/correct/)