Since you're fetching all of the languages now, please output them to the template instead of calling language_select, which generates another query.