added partial template swapping