added templates support
fixed jshint warnings