Implemented most of the library.