Hi
There are two kinds of books, the ones with a simple structure (which may have a complicated code) and the others.
If your book belongs to the first category, for terminal cases like this one, I use a Sigil plugin named
HTMLgen which saves the book to html format and, doing so, drastically simplifies the styles. Calibre has probably the equivalent but I do not have the practice.
I import the end result in LibreOffice (odt) and, after formatting publishes as an ePub. It's much quicker than it seems and provides you at the end with a clean code.