now setting values in the JS rather than in the template. Also fixes a few odd bugs