created merge arrays function