javascript templates refactored and hardcoded values moved to js object