Add scale function to index.js