Improve application.template generation