Added JSHint checking for non-Node undefined vars
Refactored side effects to bin from lib

Instead of outputting and exiting processes in lib code, throw errors
and let outputting/exiting be done by bin code. This makes use of lib
code (including in tests) much easier.