Refactor templates , working draft