Duplicate Bookmarks

Help! I have over 4400 bookmarks in Firefox! As a nasty result of an experiment gone wrong, my whole bookmark tree has been duplicated about four or five times and also been mutated a bit on each branch. There's no easy way to fix this - to remove duplicates, that is.