Clean up main template a bit.