added js template with optional function name