refactor to use thymes as template engine