added function to merge libraries