added template option
added auth handler