Removing duplicate brackets