Added a function to merge labels based a provided map