Use handlebars for templates and some refactor of codes.