Refactoring and sample template added