Try to refactore templaiting process
Try to refactore templaiting process, second iteration (work now)