implemented switching between template and design code