Refactor readerTools.js

Includes fix for some failing JavaScript tests.
Also found the source of problem with word list (BL-599), but the fix is not included in this pull request, because the bug is in the SynPhony code.
Don't you need braces after this change?