Clean up source code for template designer