Revamp the template generator.