Added code to merge arrays