Template support added.

Coded UI and controller. Refactored Main class logic to controller.