splitting and joining arrays