Modified top_template and table_template