Changed to more general template