Added template support, fixed auth