New controller for my template and some code organizing.
Refactoring.