Better separation of logic in main modules
Added specs (and mocha deps, Makefile)