Successive $data assignments were replaced with a single assignments, where possible, and a faster approach using array_merge().