Fixing issue with sorting of before and after arrays based on phrase_len