improve npm function