rearrange and fix html links