Organize templates code