Updating trends.js to do actual data processing