Changed to use template