Rewrote the library to split code in small pieces.