cleaning up code in chart1.js