code clean-up
merge sub-functions into render()

in order to make InterWiki linkid resolved correctly.