Using Dynamics and Macro Variables to Make Flexible Templates