Working on refatoring choosing of templates