huge refactoring of the libraries with shared methods