Fix a link to the top page.
Use for-in to remove duplicated code.