More changes to template.js. Issue with color change is solved. More data recorded to qdata.