implemented setDirection and mergeArrays (previously mergeVectors)