cleaning up config data pass through to templates, and adding a toJSON modifier function for templates