I don’t think rewriting the library is the best approach. I think writing a library that subclasses the original class to add your own functions or extensions is a better approach, unless the original library has too many problems to be used in this way, and most of the time that is not the case.