Added code to merge bars