Made various changes to the library. Some are important, read the code!