Refacoring ndm so that it can be included as an API 

Refactoring ndm so that it can be included as an API for creating self-installing services from npm packages.

See #51