Same as the comment above for line 283 - 287. Other than that, to avoid copy-pasting code, you may like to create a update_language_pages() function for code sharing.