Rewrote the whole lib.