more modular client module + specs + clean up of cli.js