moved javascript to template