moved logic out of npme-service-installer, added tests