added explanations for much of the weird mysql wizardry, put important set group_concat_max_len statement back