Major rewrite of the library.