packing and sorting strings