made most of the lib asynchronous