updated total computation in main.js