Refactor module and fix templates
Add spec test