refactoring the Cv temlate controller